/**
 * 
 */
package com.visikard.item;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author Nghi Do
 */
public class MerchantAccountObj implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String username = null;
	private String password = null;
	private String fname = null;
	private String lname = null;
	private String email = null;
	private long idKards = -1;
	private long idUsers = -1;
	private String fkUserType = "";
	// New
	private String merchantName = "";
	private String merchantLogo = "";
	private String imageSmall = "";
	private long idUsersMerchant = -1;
	private String phone = "";
	private String address = "";
	private String country = "";
	private String longtitude = "";
	private String latitude = "";
	private String timeOffset = "";
	private String urlKardPhoto = "";
	private String merchantIdFromRTUI = "";
	private int securityQuestionId = -1;

	public MerchantAccountObj() {

	}

	public MerchantAccountObj(JSONObject jobject) throws JSONException {
		if (jobject == null)
			return;

		username = jobject.optString("email", "");
		password = jobject.optString("password", "");
		fname = jobject.optString("accountFName", "");
		lname = jobject.optString("accountLName", "");
		email = jobject.optString("email", "");
		fkUserType = jobject.optString("userType", "");
		// New
		merchantName = jobject.optString("merchantName", "");
		merchantLogo = jobject.optString("merchantLogo", "");
		imageSmall = jobject.optString("imageSmall", "");
		idUsersMerchant = jobject.optLong("idUsersMerchant", -1);
		phone = jobject.optString("phone", "");
		address = jobject.optString("address", "");
		country = jobject.optString("country", "");
		longtitude = jobject.optString("longtitude", "");
		latitude = jobject.optString("latitude", "");
		timeOffset = jobject.optString("timeOffset", "");
		urlKardPhoto = jobject.optString("urlKardPhoto", "");
		merchantIdFromRTUI = jobject.optString("merchantIDFromRTUI", "");
		securityQuestionId = jobject.optInt("securityQuestionId", -1);
		idKards = jobject.optLong("idKards", -1);
		idUsers = jobject.optLong("fkUser", -1);
	}

	public String toJSON() throws JSONException {
		JSONObject jobj = new JSONObject();
		jobj.put("email", email);
		jobj.put("password", password);
		jobj.put("accountFName", fname);
		jobj.put("accountLName", lname);
		jobj.put("email", email);
		jobj.put("userType", fkUserType);
		// New
		jobj.put("merchantName", merchantName);
		jobj.put("merchantLogo", merchantLogo);
		jobj.put("imageSmall", imageSmall);
		jobj.optLong("idUsersMerchant", idUsersMerchant);
		jobj.put("phone", phone);
		jobj.put("address", address);
		jobj.put("country", country);
		jobj.put("longtitude", longtitude);
		jobj.put("latitude", latitude);
		jobj.put("timeOffset", timeOffset);
		jobj.put("urlKardPhoto", urlKardPhoto);
		jobj.put("merchantIDFromRTUI", merchantIdFromRTUI);
		jobj.optInt("securityQuestionId", securityQuestionId);
		jobj.optLong("idKards", idKards);
		jobj.optLong("fkUser", idUsers);

		return jobj.toString();
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the fname
	 */
	public String getFname() {
		return fname;
	}

	/**
	 * @param fname the fname to set
	 */
	public void setFname(String fname) {
		this.fname = fname;
	}

	/**
	 * @return the lname
	 */
	public String getLname() {
		return lname;
	}

	/**
	 * @param lname the lname to set
	 */
	public void setLname(String lname) {
		this.lname = lname;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the fkUserType
	 */
	public String getFkUserType() {
		return fkUserType;
	}

	/**
	 * @param fkUserType the fkUserType to set
	 */
	public void setFkUserType(String fkUserType) {
		this.fkUserType = fkUserType;
	}

	/**
	 * @return the defaultKard
	 */
	public long getIdKard() {
		return idKards;
	}

	/**
	 * @param defaultKard the defaultKard to set
	 */
	public void setIdKard(long defaultKard) {
		this.idKards = defaultKard;
	}

	/**
	 * @return the idUsers
	 */
	public long getIdUsers() {
		return idUsers;
	}

	/**
	 * @param idUsers the idUsers to set
	 */
	public void setIdUsers(long idUsers) {
		this.idUsers = idUsers;
	}

	public String getMerchantName() {
		return merchantName;
	}

	public void setMerchantName(String merchantName) {
		this.merchantName = merchantName;
	}

	public String getMerchantLogo() {
		return merchantLogo;
	}

	public void setMerchantLogo(String merchantLogo) {
		this.merchantLogo = merchantLogo;
	}

	public String getImageSmall() {
		return imageSmall;
	}

	public void setImageSmall(String imageSmall) {
		this.imageSmall = imageSmall;
	}

	public long getIdUsersMerchant() {
		return idUsersMerchant;
	}

	public void setIdUsersMerchant(long idUsersMerchant) {
		this.idUsersMerchant = idUsersMerchant;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getLongtitude() {
		return longtitude;
	}

	public void setLongtitude(String longtitude) {
		this.longtitude = longtitude;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getTimeOffset() {
		return timeOffset;
	}

	public void setTimeOffset(String timeOffset) {
		this.timeOffset = timeOffset;
	}

	public String getUrlKardPhoto() {
		return urlKardPhoto;
	}

	public void setUrlKardPhoto(String urlKardPhoto) {
		this.urlKardPhoto = urlKardPhoto;
	}

	public String getMerchantIdFromRTUI() {
		return merchantIdFromRTUI;
	}

	public void setMerchantIdFromRTUI(String merchantIdFromRTUI) {
		this.merchantIdFromRTUI = merchantIdFromRTUI;
	}

	public int getSecurityQuestionId() {
		return securityQuestionId;
	}

	public void setSecurityQuestionId(int securityQuestionId) {
		this.securityQuestionId = securityQuestionId;
	}
}
